Skip to content

Conversation

lyrixx
Copy link
Member

@lyrixx lyrixx commented Aug 6, 2025

Q A
Bug fix? no
New feature? yes
Docs? no
Issues
License MIT

I continue to bench different stores, and the next one is Redis

Demo

$ php rag/redis.php                                                                                                                   
Here are some movies that fit the theme of technology:                                                                                                                                      
                                                                                                                                                                                            
1. **The Matrix**                                                                                                                                                                           
   - **Description**: A hacker discovers the world he lives in is a simulated reality and joins a rebellion to overthrow its controllers.                                                   
   - **Director**: The Wachowskis                                                                                                                                                           
                                                                                                                                                                                            
2. **Interstellar**                                                                                                                                                                         
   - **Description**: A team of explorers travel through a wormhole in space in an attempt to ensure humanity's survival.                                                                   
   - **Director**: Christopher Nolan                                                                                                                                                        
                                                                                                                                                                                            
3. **Jurassic Park**                                                                                                                                                                        
   - **Description**: During a preview tour, a theme park suffers a major power breakdown that allows its cloned dinosaur exhibits to run amok.                                             
   - **Director**: Steven Spielberg

Symfony configuration

With a custom redis connection

ai:
    store:
        redis:
            name:
                # a service id of a Redis client
                client: my_redis
                index_name: "my_index" # required
                key_prefix: 'vector:'

                # Distance metric to use for vector similarity search
                distance: !php/enum Symfony\AI\Store\Bridge\Redis\Distance::Cosine

services:
    my_redis:
        class: Redis
        arguments:
            $options:
                host: '127.0.0.1'

Without a custom redis connection

ai:
    store:
        redis:
            name:
                # see https://github.com/phpredis/phpredis?tab=readme-ov-file#example-1
                connection_parameters:
                    host: 127.0.0.1
                    port: 6379

                index_name: "my_index"

@carsonbot carsonbot added Feature New feature Store Issues & PRs about the AI Store component Status: Needs Review labels Aug 6, 2025
@chr-hertel
Copy link
Member

Could you bring in a rag example as well, please? redis cloud or docker compose maybe

@OskarStark
Copy link
Contributor

docker compose if possible please 🙏

@lyrixx
Copy link
Member Author

lyrixx commented Aug 12, 2025

I added a rag example, with docker compose. I also updated the PR description

Copy link
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example is now easy to use & work - thanks for that!
The bundle config looks fishy tho ...

@chr-hertel
Copy link
Member

Needs a rebase after #317

@OskarStark
Copy link
Contributor

Open to finish this PR?

@lyrixx
Copy link
Member Author

lyrixx commented Sep 1, 2025

Oupsy, I forgot this one. I'll finish it ASAP

@lyrixx
Copy link
Member Author

lyrixx commented Sep 18, 2025

Here we go!

  • I have rebased the PR, fixed conflict, and adapted code to new interfaces
  • Fixed the bundle configuration, add more validation
  • Fixed tests and examples
  • Updated the PR description to configure how to use with the framework bundle

Copy link
Contributor

@OskarStark OskarStark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minors, afterwards good to merge

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds Redis vector store support to the Symfony AI Store component, enabling developers to use Redis as a backend for vector storage and similarity search operations.

Key changes:

  • Implementation of Redis vector store with RedisSearch and JSON support
  • Configuration options for Redis connections (direct client or connection parameters)
  • Support for different distance metrics (Cosine, L2, IP) and indexing methods

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/store/src/Bridge/Redis/Store.php Core Redis store implementation with vector operations and search functionality
src/store/src/Bridge/Redis/Distance.php Enum for Redis distance metrics (Cosine, L2, IP)
src/store/tests/Bridge/Redis/StoreTest.php Comprehensive test suite covering all Redis store operations
src/ai-bundle/src/AiBundle.php Bundle integration for Redis store configuration
src/ai-bundle/config/options.php Configuration schema for Redis store options
examples/rag/redis.php Example implementation demonstrating Redis store usage
examples/compose.yaml Docker Compose service for Redis development
src/store/composer.json Added polyfill dependency for PHP 8.3 features
src/store/CHANGELOG.md Documentation update listing Redis as supported store
src/ai-bundle/tests/DependencyInjection/AiBundleTest.php Test configuration for Redis store

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@symfony symfony deleted a comment from Copilot AI Sep 19, 2025
use Symfony\AI\Platform\Bridge\VertexAi\PlatformFactory as VertexAiPlatformFactory;
use Symfony\AI\Platform\Bridge\Voyage\PlatformFactory as VoyagePlatformFactory;
use Symfony\AI\Platform\Exception\RuntimeException;
use Symfony\AI\Platform\Model;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this removal?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not used, isn't?

@OskarStark
Copy link
Contributor

Lets finish this one @lyrixx 🚀 👏

@lyrixx lyrixx force-pushed the store-redis branch 2 times, most recently from a950ab0 to 8d4e8e9 Compare October 3, 2025 13:56
@lyrixx
Copy link
Member Author

lyrixx commented Oct 3, 2025

Here we go 🚀 !

I hope and think I addressed all comments.
Tests are all green 🎉

Thanks for the review, and sorry for the slow tempo on this one!

@OskarStark
Copy link
Contributor

Thank you, works great:

CleanShot 2025-10-03 at 18 35 44@2x

@OskarStark
Copy link
Contributor

It took time, but here we go, this is in now. Thank you very much @lyrixx.

@OskarStark OskarStark merged commit 0fc7fab into symfony:main Oct 3, 2025
19 of 20 checks passed
@lyrixx lyrixx deleted the store-redis branch October 3, 2025 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature Status: Needs Review Store Issues & PRs about the AI Store component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants